﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision.InnerProductSpace
{
	public class DiscretizedL2InnerProduct<Tx, Ty> : IInnerProduct<Func<Tx, Ty>, Ty>
	{
		public List<Tx> InputList { get; set; }

		#region IInnerProduct<Func<TValueBase,TOutput>,TOutput> Members

		public Ty InnerProduct(Func<Tx, Ty> left, Func<Tx, Ty> right)
		{
			Ty Result = DefaultValueProvider<Ty>.GetZero();
			foreach (Tx x in InputList)
			{
				Result += left(x) * (dynamic)right(x);
			}
			return Result;
		}

		#endregion
	}
}
